<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<? include '../console/interview_console.php'; ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../css/iframe01.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery-1.8.3.min.js"></script>
<style type="text/css">
#title{
	font-weight:bold;
	letter-spacing:2px;
}
</style>
</head>

<?php
$interview=new interview();
$allitem1=$interview->getAllitem1();

if(isset($_POST['deal_interview'])){
	$id=$_POST['id'];
	$result=$_POST['result'];
	
	if($result==NULL){
		alert("请填写处理结果!");
		open("./interview_iframe_1.php","_self");
	}else{
	$status=$interview->alterResult($id,$result);
	
	if($status==1){
		alert("操作成功!");
		open("./interview_iframe_1.php","_self");
	}else{
		alert("操作失败");
	}
	}
}
?>

<body>
<table border="0" cellspacing="0" cellpadding="5" class="table">
<tr id="title" align="left"><th>序号</th><th>姓名</th><th>面试职位</th><th width="150">面试时间</th><th>面试官</th><th>简历</th><th>面试结果</th><th width="200">处理</th></tr>
<?
$i=1;
foreach($allitem1 as $v){
	echo "<tr><td>$v[id]</td><td>$v[name]</td><td>$v[job]</td><td>$v[date]</td><td>$v[interviewer]</td><td><a href='../file_operate/file_down.php?file_name=$v[resume]'>下载</a></td><td>$v[result]</td><td id='item$v[id]'><input type='button' value='处理' onclick=deal_interview('$v[id]') class='button02'></td></tr>";
	$i++;
}
?>
</table>
<br />
<br />
<input type="button" value="添加" onclick="add_item()" class="button01" id='add_item'/>
</body>

<script language="javascript">

function deal_interview(item_id){
	var target_td=document.getElementById('item'+item_id);
	var before_td=target_td.innerHTML;
	target_td.innerHTML="<form action='./interview_iframe_1.php' method='post'>"+
	"<input type='text' name='result' class='text01'>"+
	"<input type='hidden' value='"+item_id+"' name='id'>"+
	"<input type='submit' name='deal_interview' value='确认' class='button03'>"+
	"<input type='button' value='取消' onclick=cancel_submit('"+item_id+"') class='button03'>"+
	"</form>";
}

function cancel_submit(item_id){
	var target_td=document.getElementById('item'+item_id);
	target_td.innerHTML="<input type='button' value='处理' onclick=deal_interview('"+item_id+"') class='button02'>"
}

function add_item(){
	window.location.href="./interview_iframe_add.php";
}
</script>

</html>